<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<script src="<%=path %>/js/common.js"></script>
<div class="panel-heading">
	<div class="pull-right">
		<a href="<%=path %>/base/config/info/toinsert" target="_blank">创建配置项</a>
		<a href="<%=path %>/base/dictionary/toInsert?tableColumn=config_type&columnName=配置分类" target="_blank">创建配置分类</a>
	</div>
	<h3 class="panel-title">配置项列表</h3>
</div>
<div class="bd clearfix">
	<form id="base_config_choose_form" action="javascript:void(0);">
		<div class="filter-wrap">
			<dl class="clearfix invest-filter">
				<dt>配置名称</dt>
				<dd >
					<div class="col-sm-5 mb20">
						<div class="input-group">
							<input type="text" name="configName" size="25" value="${paramMap.configName}" class="form-control" placeholder="请输入配置名称关键字">
							
						</div>
					</div>
				</dd>
				<dt>配置key</dt>
				<dd >
					<div class="col-sm-4 mb20">
						<div class="input-group">
							<input type="text" name="configKey" value="${paramMap.configKey}" class="form-control" placeholder="请输入配置key关键字">	
							<span class="input-group-btn">
								<button class="btn btn-primary" type="button" onclick="javascript:queryConfigList(1);">搜索</button>
							</span>					
						</div>
					</div>
				</dd>
			</dl>
			<d:radio describe="配置分类" tableColumn="config_type" fieldName="configType" type="query" value="${paramMap.configType}" queryFunction="queryConfigList"/>
		</div>
	</form>
</div>
<c:choose>
<c:when test="${!empty dataList && fn:length(dataList) ne 0}">
<table class="table">
	<thead>
		<tr>
			<th width="20%">配置名称</th>
			<th width="20%">配置key</th>
			<th width="15%">配置分类</th>
			<th width="25%">配置值</th>
			<th width="20%">操作</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach var="configInfo" items="${dataList}" varStatus="index">
		<tr>
			<td ><a href="<%=path %>/base/config/info/detail/${configInfo.configId}" target="_blank">${configInfo.configName}</a></td>
			<td >${configInfo.configKey}</td>
			<td >${configInfo.configTypeName}</td>
			<td>${configInfo.configValue}</td>
			<td>
				<a href="javascript:deleteConfigItemById('${configInfo.configId}')" >删除</a>
			</td>
		</tr>
		</c:forEach>
	</tbody>
</table>
<!-- 分页 -->
<p:pagination pageNo="${paramMap.pageNo}" pageCount="${paramMap.pageCount}" queryFunction="queryConfigList" style="text-center"></p:pagination>
<!-- 分页 end -->
</c:when>
<c:otherwise>
	<table class="table">
		<thead>
			<tr>
				<th width="30%">姓名</th>
				<th width="30%">帐号</th>
				<th width="40%">操作</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td colspan="3" align="center">
					暂无数据
				</td>
			</tr>
		</tbody>
	</table>
</c:otherwise>
</c:choose>
<script type="text/javascript">
	function deleteConfigItemById(configId) {
		$.ajax({
			url : path + "/base/config/info/delete/" + configId,
			type : "post",
			dataType : "json",
			success : function(data) {
				if (data.result) {
					layer.msg("删除配置项成功", {
						icon : 1
					});
					queryConfigList(1);
				} else {
					layer.msg(data.message, {
						icon : 2
					});
					;
				}
			},
			error : function() {
				layer.msg("服务器网络繁忙", {
					icon : 2
				});
			}
		});
	}	
</script>